<?php

namespace Sm\AssBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use DateTime;
use Doctrine\ORM\Mapping\Index;

/**
 * Ass
 *
 * @ORM\Table(name="sm_ass", indexes={@ORM\Index(name="importdate_idx", columns={"importdate"})})
 * @ORM\Entity(repositoryClass="Sm\AssBundle\Entity\AssRepository")
 * @Vich\Uploadable
 * 
 */
class Ass
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

     /**
     * @Assert\File(
     *     maxSize="1M"
     * )
     * @Vich\UploadableField(mapping="assfile", fileNameProperty="assname")
     *
     * @var File $assfile
     */
    protected $assfile;
    
    /**
     * @ORM\Column(type="string", length=255, name="assname")
     *
     * @var string $assname
     */
    protected $assname;
    
    
    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=true)
     */
    private $name;

    /**
     * @var integer
     *
     * @ORM\Column(name="playresx", type="integer")
     */
    private $playresx;

    /**
     * @var integer
     *
     * @ORM\Column(name="playresy", type="integer")
     */
    private $playresy;
    
    /**
     * @var datetime
     *
     * @ORM\Column(name="importdate", type="datetime")
     */
    private $importdate;
    
    /**
     * @ORM\OneToMany(targetEntity="Sm\AssBundle\Entity\Srt", mappedBy="ass", cascade={"remove", "persist"})
     * @ORM\JoinColumn(nullable=false) 
     */
    private $srts;
    
    /**
     * @ORM\OneToMany(targetEntity="Sm\AssBundle\Entity\Style", mappedBy="ass", cascade={"remove", "persist"})
     * @ORM\JoinColumn(nullable=false) 
     */
    private $styles;
    
    private $lineNumber;

    public function __construct() {
        
        $this->importdate = new Datetime();
        $this->playresx = 1280;
        $this->playresy = 720;
        $this->srts = new \Doctrine\Common\Collections\ArrayCollection();
        $this->lineNumber = 1;
        
    }
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Ass
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }


    /**
     * Set importdate
     *
     * @param \DateTime $importdate
     * @return Ass
     */
    public function setImportdate($importdate)
    {
        $this->importdate = $importdate;

        return $this;
    }

    /**
     * Get importdate
     *
     * @return \DateTime 
     */
    public function getImportdate()
    {
        return $this->importdate;
    }

    /**
     * Set assname
     *
     * @param string $assname
     * @return Ass
     */
    public function setAssname($assname)
    {
        $this->assname = $assname;

        return $this;
    }

    /**
     * Get assname
     *
     * @return string 
     */
    public function getAssname()
    {
        return $this->assname;
    }
    
    /**
     * Set assfile
     *
     * @param string $assfile
     * @return Ass
     */
    public function setAssfile($assfile)
    {
        $this->assfile = $assfile;

        return $this;
    }

    /**
     * Get assfile
     *
     * @return string 
     */
    public function getAssfile()
    {
        return $this->assfile;
    }


    /**
     * Set playresx
     *
     * @param integer $playresx
     * @return Ass
     */
    public function setPlayresx($playresx)
    {
        $this->playresx = $playresx;

        return $this;
    }

    /**
     * Get playresx
     *
     * @return integer 
     */
    public function getPlayresx()
    {
        return $this->playresx;
    }

    /**
     * Get lineNumber
     *
     * @return integer 
     */
    public function getLineNumber()
    {
        $number = $this->lineNumber;
        $this->lineNumber++;
        
        return $number;
    }

    /**
     * Set playresy
     *
     * @param integer $playresy
     * @return Ass
     */
    public function setPlayresy($playresy)
    {
        $this->playresy = $playresy;

        return $this;
    }

    /**
     * Get playresy
     *
     * @return integer 
     */
    public function getPlayresy()
    {
        return $this->playresy;
    }

    /**
     * Add srts
     *
     * @param \Sm\AssBundle\Entity\Srt $srt
     * @return Ass
     */
    public function addSrt(\Sm\AssBundle\Entity\Srt $srt)
    {
        $this->srts[] = $srt;

        return $this;
    }

    /**
     * Remove srts
     *
     * @param \Sm\AssBundle\Entity\Srt $srts
     */
    public function removeSrt(\Sm\AssBundle\Entity\Srt $srt)
    {
        $this->srts->removeElement($srt);
    }

    /**
     * Get srts
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getSrts()
    {
        return $this->srts;
    }

    /**
     * Add styles
     *
     * @param \Sm\AssBundle\Entity\Style $style
     * @return Ass
     */
    public function addStyle(\Sm\AssBundle\Entity\Style $style)
    {
        $this->styles[] = $style;

        return $this;
    }

    /**
     * Remove styles
     *
     * @param \Sm\AssBundle\Entity\Style $style
     */
    public function removeStyle(\Sm\AssBundle\Entity\Style $style)
    {
        $this->styles->removeElement($style);
    }

    /**
     * Get styles
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getStyles()
    {
        return $this->styles;
    }
}
